﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Jemgine.MapEditor.Operations
{
	internal class TerminalTargetChanged : Operation
	{
        Data.Terminal Terminal;
        Object OldTarget;
        Object NewTarget;

        internal TerminalTargetChanged(Data.Terminal Terminal, Object NewTarget)
        {
            this.Terminal = Terminal;
            this.OldTarget = Terminal.GetTarget();
            this.NewTarget = NewTarget;
        }

        internal override ReturnCode Do(EditorState ES)
		{
            Terminal.SetTarget(NewTarget);
            return ReturnCode.AddToUndoStack;
		}

        internal override void Undo(EditorState ES)
        {
            Terminal.SetTarget(OldTarget);
        }
	}
}
